package com.ljh.localmusic.data.local.models

import android.graphics.Bitmap
import android.net.Uri
import androidx.media3.common.MediaItem
import androidx.media3.common.MediaMetadata
import com.google.gson.annotations.Expose

data class AudioItem(
    val id: Long,
    val uri: Uri,
    val displayName: String,
    val artist: String,
    val duration: Int,
    val title: String,
    val data: String,
    @Expose(serialize = false, deserialize = false)
    val artWork: Uri?,
){
    companion object{
        fun toMediaItem(audioItem: AudioItem): MediaItem {
            return MediaItem
                .Builder()
                .setUri(audioItem.uri)
                .setMediaMetadata(
                    MediaMetadata
                        .Builder()
                        .setAlbumArtist(audioItem.artist)
                        .setDisplayTitle(audioItem.title)
                        .setSubtitle(audioItem.displayName)
                        .build()
                )
                .build()
        }
    }
}